package myqueuegather;

import java.util.Queue;

public class TestDemo {
    public static void main(String[] args) {
        MyQueue myQueue = new MyQueue();
//        myQueue.offer(1);// 入队
//        myQueue.offer(2);
        // 出队
        try{
            System.out.println(myQueue.poll().val);// 1
        }catch (NullPointerException e){
            e.printStackTrace();
            System.out.println("队列为空 【poll】");
        }
        // 返回头数据
        try {
            System.out.println(myQueue.peek().val);// 2
        }catch (NullPointerException e){
            e.printStackTrace();
            System.out.println("队列为空【peek】");
        }
    }
}





